home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1378 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: dal1498.computek.net!user
  2. From: coc@computek.net (Chad Cranfill)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What the hell is THIS?!
  5. Date: Sat, 13 Jan 1996 02:53:42 -0600
  6. Organization: Compu-Net DFW's Premiere Internet Access Provider
  7. Message-ID: <coc-1301960253420001@dal1498.computek.net>
  8. References: <4d6rgh$rfu@abel.cc.sunysb.edu>
  9. NNTP-Posting-Host: dal1498.computek.net
  10. X-Newsreader: Yet Another NewsWatcher 2.1.5
  11.  
  12. In article <4d6rgh$rfu@abel.cc.sunysb.edu>, bmadhusu@engws12.ic.sunysb.edu
  13. (Bommasamudram Madhusudan) wrote:
  14.  
  15. > Can someone explain what
  16. >   int (*p)[3]  is?????
  17.  
  18. Starting with the "p", we parse the expression thusly: "p is an array of 3
  19. pointers to int". If you need help with this (believe me, I did!) get the
  20. book "Deep C Secrets". It presents an algorithmic method for decoding
  21. statements like this, and gives hints on how to implement a C program that
  22. will do this for you.
  23.  
  24. > I can say things like:
  25. > (*p)[0] = 3; for e.g, but when I print the value using:
  26. >  printf("%d",(*p)[0]) I get a core dump!
  27.  
  28. Instead of using the dereference operator here, you may want to just say:
  29.  
  30. printf("%d", p[0]);
  31.  
  32. This just seems to be the intuitive way to do this, but since I haven't
  33. tried this example I could be wrong.
  34.  
  35. --Chad
  36.